\hypertarget{class_exercise__2__1__2}{
\section{Exercise\_\-2\_\-1\_\-2 Class Reference}
\label{class_exercise__2__1__2}\index{Exercise\_\-2\_\-1\_\-2@{Exercise\_\-2\_\-1\_\-2}}
}


\hyperlink{class_exercise}{Exercise} 2.1-\/2 First, we implement the insertion sort algorithm as desribed in the chapter (non-\/decreasing order), and then we implement it like asked in the exercise (non-\/increasing).  




{\ttfamily \#include $<$Exercise\_\-2\_\-1\_\-2.h$>$}

Inheritance diagram for Exercise\_\-2\_\-1\_\-2:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{class_exercise__2__1__2}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_exercise__2__1__2_aee95b0c5b0832883f6b25a43c6dd7086}{Exercise\_\-2\_\-1\_\-2} ()
\item 
virtual \hyperlink{class_exercise__2__1__2_ae55ac043ea01f13e0a601cc116ecc58c}{$\sim$Exercise\_\-2\_\-1\_\-2} ()
\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
std::string \hyperlink{class_exercise__2__1__2_af94ec98aedfc0a3514b3b00fd219f62d}{getTableString} (int $\ast$\_\-aiTable, int \_\-iSize)
\begin{DoxyCompactList}\small\item\em Return a string containing the data of the table with the following format : \char`\"{}tab\mbox{[}0\mbox{]}, tab\mbox{[}1\mbox{]}, tab\mbox{[}2\mbox{]}, ...\char`\"{}, each tab\mbox{[}i\mbox{]} equal to the i-\/th element of the table. \end{DoxyCompactList}\item 
virtual void \hyperlink{class_exercise__2__1__2_acf68987a01d1e34fa5b25ce0a261bace}{implementation} ()
\begin{DoxyCompactList}\small\item\em Implementation of the exercise solution by calling \hyperlink{class_exercise__2__1__2_a012e84d618a56341f1a5f07de642dc5a}{Exercise\_\-2\_\-1\_\-2::insertionSortIncreasing()} and \hyperlink{class_exercise__2__1__2_ab3647f5e2649bea892218be036b314d5}{Exercise\_\-2\_\-1\_\-2::insertionSortDecreasing()} with the two tables given in the chapter 2.1 of the book and printing the results on the console. \end{DoxyCompactList}\item 
void \hyperlink{class_exercise__2__1__2_ab3647f5e2649bea892218be036b314d5}{insertionSortDecreasing} (int $\ast$\_\-aiTableIn, int $\ast$\_\-aiTableOut, int \_\-iSize)
\begin{DoxyCompactList}\small\item\em Sort an int table by decreasing order using insertion algorithm, solution of the exercuse 2.1-\/2. The solution was just to change the test in the while, whith a \char`\"{}$<$\char`\"{} instead of a \char`\"{}$>$\char`\"{}. \end{DoxyCompactList}\item 
void \hyperlink{class_exercise__2__1__2_a012e84d618a56341f1a5f07de642dc5a}{insertionSortIncreasing} (int $\ast$\_\-aiTableIn, int $\ast$\_\-aiTableOut, int \_\-iSize)
\begin{DoxyCompactList}\small\item\em Sort by increasing order using insertion algorithm. Refer to the paragraph 2.1 of the book for more explanation about this algorithm. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{class_exercise__2__1__2_a618ad2134a7bb9adc0bfd72e7fb512bc}{m\_\-aiTabToSort} \mbox{[}2\mbox{]}\mbox{[}6\mbox{]}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
\hyperlink{class_exercise}{Exercise} 2.1-\/2 First, we implement the insertion sort algorithm as desribed in the chapter (non-\/decreasing order), and then we implement it like asked in the exercise (non-\/increasing). 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_exercise__2__1__2_aee95b0c5b0832883f6b25a43c6dd7086}{
\index{Exercise\_\-2\_\-1\_\-2@{Exercise\_\-2\_\-1\_\-2}!Exercise\_\-2\_\-1\_\-2@{Exercise\_\-2\_\-1\_\-2}}
\index{Exercise\_\-2\_\-1\_\-2@{Exercise\_\-2\_\-1\_\-2}!Exercise_2_1_2@{Exercise\_\-2\_\-1\_\-2}}
\subsubsection[{Exercise\_\-2\_\-1\_\-2}]{\setlength{\rightskip}{0pt plus 5cm}Exercise\_\-2\_\-1\_\-2::Exercise\_\-2\_\-1\_\-2 (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_exercise__2__1__2_aee95b0c5b0832883f6b25a43c6dd7086}
\hypertarget{class_exercise__2__1__2_ae55ac043ea01f13e0a601cc116ecc58c}{
\index{Exercise\_\-2\_\-1\_\-2@{Exercise\_\-2\_\-1\_\-2}!$\sim$Exercise\_\-2\_\-1\_\-2@{$\sim$Exercise\_\-2\_\-1\_\-2}}
\index{$\sim$Exercise\_\-2\_\-1\_\-2@{$\sim$Exercise\_\-2\_\-1\_\-2}!Exercise_2_1_2@{Exercise\_\-2\_\-1\_\-2}}
\subsubsection[{$\sim$Exercise\_\-2\_\-1\_\-2}]{\setlength{\rightskip}{0pt plus 5cm}Exercise\_\-2\_\-1\_\-2::$\sim$Exercise\_\-2\_\-1\_\-2 (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{class_exercise__2__1__2_ae55ac043ea01f13e0a601cc116ecc58c}


\subsection{Member Function Documentation}
\hypertarget{class_exercise__2__1__2_af94ec98aedfc0a3514b3b00fd219f62d}{
\index{Exercise\_\-2\_\-1\_\-2@{Exercise\_\-2\_\-1\_\-2}!getTableString@{getTableString}}
\index{getTableString@{getTableString}!Exercise_2_1_2@{Exercise\_\-2\_\-1\_\-2}}
\subsubsection[{getTableString}]{\setlength{\rightskip}{0pt plus 5cm}std::string Exercise\_\-2\_\-1\_\-2::getTableString (
\begin{DoxyParamCaption}
\item[{int $\ast$}]{\_\-aiTable, }
\item[{int}]{\_\-iSize}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_exercise__2__1__2_af94ec98aedfc0a3514b3b00fd219f62d}


Return a string containing the data of the table with the following format : \char`\"{}tab\mbox{[}0\mbox{]}, tab\mbox{[}1\mbox{]}, tab\mbox{[}2\mbox{]}, ...\char`\"{}, each tab\mbox{[}i\mbox{]} equal to the i-\/th element of the table. 


\begin{DoxyParams}{Parameters}
{\em \_\-aiTable} & Table of int to print. \\
\hline
{\em \_\-iSize} & Size of the table.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A string containing the data of the table. 
\end{DoxyReturn}
\hypertarget{class_exercise__2__1__2_acf68987a01d1e34fa5b25ce0a261bace}{
\index{Exercise\_\-2\_\-1\_\-2@{Exercise\_\-2\_\-1\_\-2}!implementation@{implementation}}
\index{implementation@{implementation}!Exercise_2_1_2@{Exercise\_\-2\_\-1\_\-2}}
\subsubsection[{implementation}]{\setlength{\rightskip}{0pt plus 5cm}void Exercise\_\-2\_\-1\_\-2::implementation (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private, virtual\mbox{]}}}}
\label{class_exercise__2__1__2_acf68987a01d1e34fa5b25ce0a261bace}


Implementation of the exercise solution by calling \hyperlink{class_exercise__2__1__2_a012e84d618a56341f1a5f07de642dc5a}{Exercise\_\-2\_\-1\_\-2::insertionSortIncreasing()} and \hyperlink{class_exercise__2__1__2_ab3647f5e2649bea892218be036b314d5}{Exercise\_\-2\_\-1\_\-2::insertionSortDecreasing()} with the two tables given in the chapter 2.1 of the book and printing the results on the console. 



Implements \hyperlink{class_exercise_a59e53156a35ac23269d30714314017a3}{Exercise}.

\hypertarget{class_exercise__2__1__2_ab3647f5e2649bea892218be036b314d5}{
\index{Exercise\_\-2\_\-1\_\-2@{Exercise\_\-2\_\-1\_\-2}!insertionSortDecreasing@{insertionSortDecreasing}}
\index{insertionSortDecreasing@{insertionSortDecreasing}!Exercise_2_1_2@{Exercise\_\-2\_\-1\_\-2}}
\subsubsection[{insertionSortDecreasing}]{\setlength{\rightskip}{0pt plus 5cm}void Exercise\_\-2\_\-1\_\-2::insertionSortDecreasing (
\begin{DoxyParamCaption}
\item[{int $\ast$}]{\_\-aiTableIn, }
\item[{int $\ast$}]{\_\-aiTableOut, }
\item[{int}]{\_\-iSize}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_exercise__2__1__2_ab3647f5e2649bea892218be036b314d5}


Sort an int table by decreasing order using insertion algorithm, solution of the exercuse 2.1-\/2. The solution was just to change the test in the while, whith a \char`\"{}$<$\char`\"{} instead of a \char`\"{}$>$\char`\"{}. 


\begin{DoxyParams}{Parameters}
{\em \_\-aiTableIn} & Table of int to sort. \\
\hline
{\em \_\-aiTableOut} & Table of int sorted. \\
\hline
{\em \_\-iSize} & Size of the table. \\
\hline
\end{DoxyParams}
\hypertarget{class_exercise__2__1__2_a012e84d618a56341f1a5f07de642dc5a}{
\index{Exercise\_\-2\_\-1\_\-2@{Exercise\_\-2\_\-1\_\-2}!insertionSortIncreasing@{insertionSortIncreasing}}
\index{insertionSortIncreasing@{insertionSortIncreasing}!Exercise_2_1_2@{Exercise\_\-2\_\-1\_\-2}}
\subsubsection[{insertionSortIncreasing}]{\setlength{\rightskip}{0pt plus 5cm}void Exercise\_\-2\_\-1\_\-2::insertionSortIncreasing (
\begin{DoxyParamCaption}
\item[{int $\ast$}]{\_\-aiTableIn, }
\item[{int $\ast$}]{\_\-aiTableOut, }
\item[{int}]{\_\-iSize}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_exercise__2__1__2_a012e84d618a56341f1a5f07de642dc5a}


Sort by increasing order using insertion algorithm. Refer to the paragraph 2.1 of the book for more explanation about this algorithm. 


\begin{DoxyParams}{Parameters}
{\em \_\-aiTableIn} & Table of int to sort. \\
\hline
{\em \_\-aiTableOut} & Table of int sorted. \\
\hline
{\em \_\-iSize} & Size of the table. \\
\hline
\end{DoxyParams}


\subsection{Member Data Documentation}
\hypertarget{class_exercise__2__1__2_a618ad2134a7bb9adc0bfd72e7fb512bc}{
\index{Exercise\_\-2\_\-1\_\-2@{Exercise\_\-2\_\-1\_\-2}!m\_\-aiTabToSort@{m\_\-aiTabToSort}}
\index{m\_\-aiTabToSort@{m\_\-aiTabToSort}!Exercise_2_1_2@{Exercise\_\-2\_\-1\_\-2}}
\subsubsection[{m\_\-aiTabToSort}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf Exercise\_\-2\_\-1\_\-2::m\_\-aiTabToSort}\mbox{[}2\mbox{]}\mbox{[}6\mbox{]}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_exercise__2__1__2_a618ad2134a7bb9adc0bfd72e7fb512bc}


The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
/home/marc/SVN/IntroToAlgo/Chapter2/\hyperlink{_exercise__2__1__2_8h}{Exercise\_\-2\_\-1\_\-2.h}\item 
/home/marc/SVN/IntroToAlgo/Chapter2/\hyperlink{_exercise__2__1__2_8cpp}{Exercise\_\-2\_\-1\_\-2.cpp}\end{DoxyCompactItemize}
